//
//  CycTableViewCell.m
//  Cycling
//
//  Created by chijianguo on 2023/3/12.
//

#import "CycTableViewCell.h"
#import "Public.h"

@implementation CycTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{
    
    if (highlighted) {
        self.backgroundColor = COLOR_APP_BACKGROUND;
        self.layer.masksToBounds = YES;
        self.layer.cornerRadius = DEFAULT_CORNER_RADIUS;
    }else{
        self.backgroundColor = COLOR_APP_BACKGROUND;
    }
    [super setHighlighted:highlighted animated:animated];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUp];
    }
    return self;
}
- (void)setUp{
    self.backgroundColor = COLOR_WHITE;
    self.layer.masksToBounds = YES;
    self.layer.cornerRadius = DEFAULT_CORNER_RADIUS;
}

- (void)setFrame:(CGRect)frame{
   frame.origin.x += MARGIN_MAX;
   frame.origin.y += MARGIN_MIDDLE/2;
   frame.size.height -= MARGIN_MIDDLE;
   frame.size.width -= MARGIN_MAX * 2;
   [super setFrame:frame];
}


@end
